from pathlib import Path

import pytest
import yaml

class Config:

    def __init__(self,config_path=None):
        config_path = config_path or Path(__file__).parent / "config.yaml"
        with open(config_path,'r') as file:
            self.config = yaml.safe_load(file)

    #获取网址
    def get_login_url(self):
        """
        获取登录网址
        :return:
        """
        return self.config['web']['login_url']
    #获取发送人邮箱
    def get_sender(self):
        """
        获取发送人邮箱
        :return:
        """
        return self.config['email']['sender']
    #获取收件人邮箱
    def get_receiver(self):
        """
        获取收件人邮箱
        :return:
        """
        return self.config['email']['recipient']
    #获取发件人邮箱授权码
    def get_authorization_code(self):
        """
        获取发件人邮箱授权码
        :return:
        """
        return self.config['email']['authorization_code']
    #获取协议
    def get_host(self):
        """
        获取协议
        :return:
        """
        return self.config['email']['host']
    #获取端口号
    def get_port(self):
        """
        获取端口号
        :return:
        """
        return self.config['email']['port']
    #获取数据库网址
    def get_db_host(self):
        """
        获取数据库网址
        :return:
        """
        return self.config['mysql']['host']
    #获取端口号
    def get_db_port(self):
        """
        获取端口号
        :return:
        """
        return self.config['mysql']['port']
    #获取用户名
    def get_db_user(self):
        """
        获取用户名
        :return:
        """
        return self.config['mysql']['user']
    #获取密码
    def get_db_password(self):
        """
        获取密码
        :return:
        """
        return self.config['mysql']['password']
    #help
    def get_db_help(self):
        """
        获取help
        :return:
        """
        return self.config['mysql']['database']


